<template>
  <div>
    <el-container>
      <el-header>
        <div id="logoname">校园疫情防控管理系统</div>
        <div id="setting">
          <span>欢迎您，{{username}}</span>
          <el-dropdown>
            <i
              class="el-icon-setting"
              style="margin-left: 15px; color: white"
            ></i>
            <el-dropdown-menu slot="dropdown">
              <el-dropdown-item @click.native="pushLogin">退出登录</el-dropdown-item>
            </el-dropdown-menu>
          </el-dropdown>
        </div>
      
      </el-header>
      <el-container id="content">
        <el-aside width="200px">
          <el-menu
            default-active="1"
            class="el-menu-vertical-demo"
            background-color="#545c64"
            text-color="#fff"
            active-text-color="#ffd04b"
          >
            <el-menu-item index="1" @click="goTo('adminindex')">
              <i class="el-icon-location"></i>
              <span slot="title">首页</span>
            </el-menu-item>
            <el-menu-item index="2" @click="goTo('adminpeople')">
              <i class="el-icon-menu"></i>
              <span slot="title">人员管理</span>
            </el-menu-item>
            <el-menu-item index="3" @click="goTo('adminmessage')">
              <i class="el-icon-document"></i>
              <span slot="title">通知管理</span>
            </el-menu-item>
          </el-menu>
        </el-aside>
        <el-main>
          <router-view />
        </el-main>
      </el-container>
    </el-container>
  </div>
</template>

<script>
export default {
  created: function () {
    this.getIndex();
  },
  methods: {
    goTo(tmp) {
      console.log(tmp);
      this.$router.push(tmp);
    },
    pushLogin() {
      this.$router.push("/login");
    },
    getIndex() {
      this.$api({
        url: "/index/admin_info",
        method: "post",
        data: { count: window.localStorage.getItem("username") },
        success: (data) => {
          this.username=data[0].name
        },
      });
    }
  },
  data() {
    return {
      username:"",
    };
  },
};
</script>



<style lang="scss"  >
body {
  padding: 0;
  margin: 0;
}
#content {
  height: 876px;
}
a {
  text-decoration: none;
}
.el-header {
  background-color: rgb(118, 204, 164);
  color: rgb(255, 255, 255);
  // text-align: center;
  line-height: 60px;
  display: flex;
  justify-content: space-between;
  #logoname {
    margin-left: 100px;
    color: #ffffff;
    font-size: 20px;
    letter-spacing: 4px;
  }
  #setting {
    margin-right: 100px;
  }
}
.el-menu-item {
  width: 200px;
}
.el-aside {
  background-color: #545c64;
  line-height: 200px;
}

// .el-main {
//   color: #333;
//   text-align: center;
//   line-height: 160px;
// }

body > .el-container {
  margin-bottom: 40px;
}
</style>